package vn.fpt.fsoft.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/*
 * Entiy.
 *
 * Version 1.0
 *
 * 22-August-2014
 *
 * Modification Logs:
 * DATE                 AUTHOR              DESCRIPTION
 * --------------------------------------------------------
 * 22-August-2014       NguyenTuyen          County
 */
@Entity
public class County implements java.io.Serializable {
    
    /**
     * Serial version.
     */
    private static final long serialVersionUID = 1L;
    
    /**
     * CountyID.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "CountyID", nullable = false)
    private int countyID;
    
    /**
     * CountyName.
     */
    @Column(name = "CountyName", nullable = false, length = 45)
    private String countyName;
    
    /**
     * Mapping with Government office region.
     */
    @OneToMany(mappedBy = "county")
    private Set<GovOfficeRegion> govOfficeRegion;
    
    /**
     * Mapping with country.
     */
    @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name = "CountryID")
    private Country country;
    
    /**
     * Constructor default.
     */
    public County() {
        
    }
    
    /**
     * Constructor with a param.
     * 
     * @param countyName
     */
    public County(String countyName) {
        this.countyName = countyName;
    }
    
    /**
     * Get County ID.
     * 
     * @return
     */
    public int getCountyID() {
        return countyID;
    }
    
    /**
     * Set country ID.
     * 
     * @param countyID
     */
    public void setCountyID(int countyID) {
        this.countyID = countyID;
    }
    
    /**
     * Get county name.
     * 
     * @return
     */
    public String getCountyName() {
        return countyName;
    }
    
    /**
     * Set county name.
     * 
     * @param countyName
     */
    public void setCountyName(String countyName) {
        this.countyName = countyName;
    }
    
    /**
     * Get a country.
     * 
     * @return
     */
    public Set<GovOfficeRegion> getGovOfficeRegion() {
        return govOfficeRegion;
    }
    
    /**
     * Set a country.
     * 
     * @param govOfficeRegion
     */
    public void setGovOfficeRegion(Set<GovOfficeRegion> govOfficeRegion) {
        this.govOfficeRegion = govOfficeRegion;
    }
    
    public Country getCountry() {
        return country;
    }
    
    public void setCountry(Country country) {
        this.country = country;
    }
    
}
